package com.xiao.mall.client.message.feign;

import com.xiao.mall.client.message.dto.NotificationDto;
import com.xiao.mall.client.message.dto.SmsCaptchaDTO;
import com.xiao.mall.client.message.dto.UserLoginDto;
import com.xiao.mall.client.message.dto.UserNotificationDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.net.URISyntaxException;

/**
 * @author zhm
 */
@FeignClient(value = "tbt-mall-message", contextId = "message-client", url = "${tbt.client.message:}")
public interface MessageClient {

    @PostMapping("/sms/captcha")
    ResponseEntity<SmsCaptchaDTO> buildSmsCaptcha(@RequestBody SmsCaptchaDTO dto) throws URISyntaxException;

    @PostMapping("/sms/captcha-validated")
    ResponseEntity<Boolean> validateSmsCaptcha(@RequestBody SmsCaptchaDTO dto) throws URISyntaxException;

    @PostMapping("/notification/user/binding")
    ResponseEntity<Boolean> userLoginBinding(@RequestBody UserLoginDto userLoginDto);

    @PostMapping("/notification")
    ResponseEntity<UserNotificationDto> createChannelNotification(@RequestParam(name = "channel") String channel,
                                                                  @RequestParam(name = "to") String userId,
                                                                  @RequestBody NotificationDto dto);
}
